package com.zxz.headller;

import com.zxz.vo.JsonResult;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class TestExceptionHandler {
    @ExceptionHandler({Exception.class})
    public JsonResult<Boolean> handleRuntimeException(final Exception re) {
        re.printStackTrace();
        System.out.println("TestExceptionHandler start");
        JsonResult<Boolean> jsonResult = new JsonResult<>();
        jsonResult.setCode("1");
        jsonResult.setMessage("error");
        return jsonResult;
    }
}
